﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ccit.Utils; 
using System.Collections.Generic;
using Ccit.OA.MsAddrBook;

namespace Ccit.OA.AddrBook
{
    public class AddrBookBLL
    {
        private IAddrBook iAddrBook = null;
        public AddrBookBLL()
        {
            iAddrBook = (IAddrBook)Factory.CreateObject("Ccit.OA.AddrBook.dll", "Ccit.OA.AddrBook.AddrBook",
                                                ImportComponentType.DotNetDll, null);
        }
        #region 获取个人通讯录列表信息
        /// <summary>
        /// 获取个人通讯录列表信息
        /// </summary>
        /// <param name="Query"></param>
        /// <returns></returns>
        public DataSet GetAddBookMes(string Query)
        {
            DataSet dSet = iAddrBook.GetAddBookMes(Query);
            iAddrBook = null;
            return dSet;
        }
        /// <summary>
        /// 删除个人通讯录信息
        /// </summary>
        /// <param name="sRecid"></param>
        /// <returns></returns>
        public string DoOperateBook(string sRecid)
        {
            string iNum = iAddrBook.DoOperateBook(sRecid);
            iAddrBook = null;
            return iNum;
        }  /// <summary>
        /// 保存个人通讯录信息
        /// </summary>
        /// <param name="ms"></param>
        /// <returns></returns>
        public List<string> DoSaveAddBookMes(MsAddBooks ms)
        {
            List<string> lstResult = iAddrBook.DoSaveAddBookMes(ms);
            iAddrBook = null;
            return lstResult;
        }
         /// <summary>
        /// 获取编辑页面信息
        /// </summary>
        /// <param name="sRecId"></param>
        /// <returns></returns>
        public MsAddBooks GetEditAddBookMes(string sRecId)
        {
            MsAddBooks ms = iAddrBook.GetEditAddBookMes(sRecId);
            iAddrBook = null;
            return ms;
        }
        /// <summary>
        /// 获取设置分组信息
        /// </summary>
        /// <returns></returns>
        public List<MsAddBookDetail> GetAddBookGroupMes()
        {
            List<MsAddBookDetail> lstGroup = iAddrBook.GetAddBookGroupMes();
            iAddrBook = null;
            return lstGroup;
        }
         /// <summary>
        /// 保存设置分组信息
        /// </summary>
        /// <param name="ms"></param>
        /// <returns></returns>
        public string DoSaveGroupMes(MsAddBookDetail ms)
        {
            string iNum = iAddrBook.DoSaveGroupMes(ms);
            iAddrBook = null;
            return iNum;
        }
        /// <summary>
        /// 修改个人通讯录分组信息
        /// </summary>
        /// <param name="sRecId"></param>
        /// <returns></returns>
        public string DaUpdateAddBookGroup(MsAddBooks ms)
        {
            string iNum = iAddrBook.DaUpdateAddBookGroup(ms);
            iAddrBook = null;
            return iNum;
        }
        /// <summary>
        /// 删除分组信息
        /// </summary>
        /// <param name="sRecId"></param>
        /// <returns></returns>
        public string DaOperateGroup(string sRecId)
        {
            string iNum = iAddrBook.DaOperateGroup(sRecId);
            iAddrBook = null;
            return iNum;
        }
         /// <summary>
        /// 获取导出Execl数据
        /// </summary>
        /// <param name="sRecId"></param>
        /// <returns></returns>
        public List<MsAddBooks> GetAddBooksExcelMes(string sRecId)
        {
            List<MsAddBooks> lstAddBooks = iAddrBook.GetAddBooksExcelMes(sRecId);
            iAddrBook = null;
            return lstAddBooks;
        }
         /// <summary>
        /// 保存excel导入的数据
        /// </summary>
        /// <param name="lstAddBooks"></param>
        /// <returns></returns>
        public string SaveImportExcelMes(List<MsAddBooks> lstAddBooks)
        {
            string iNum = iAddrBook.SaveImportExcelMes(lstAddBooks);
            iAddrBook = null;
            return iNum;
        }
        #endregion
    }
}
